cmake_minimum_required(VERSION 3.8)
project(Sample VERSION 2.0.0)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib)

if(MSVC)
	add_compile_options("/source-charset:utf-8")
endif(MSVC)

include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/src)
include_directories(${CMAKE_SOURCE_DIR}/src/app)
include_directories(${CMAKE_SOURCE_DIR}/src/components)
include_directories(${CMAKE_SOURCE_DIR}/src/framework)
include_directories(${CMAKE_SOURCE_DIR}/src/backends)
include_directories(${CMAKE_SOURCE_DIR}/src/misc)
include_directories(${CMAKE_SOURCE_DIR}/third-party)

link_directories(${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})



# 添加源文件路径
file(GLOB_RECURSE DMEO_SOURCE   ${CMAKE_SOURCE_DIR}/examples/*.cpp ${CMAKE_SOURCE_DIR}/examples/*.h)
#file(GLOB_RECURSE SRC_THIRD_GLAD ${CMAKE_SOURCE_DIR}/third-party/glad/*.cpp ${CMAKE_SOURCE_DIR}/third-party/glad/*.h)

# 生成动态链接库
add_executable(Sample
 ${DMEO_SOURCE} 
 #${SRC_THIRD_GLAD}
)

if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
    set_target_properties(Sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/bin/${CMAKE_BUILD_TYPE})
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
    set_target_properties(Sample PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin)
endif()


if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
	target_link_libraries(Sample libsweety.lib)

elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
	target_link_libraries(Sample libsweety.so)
	
endif()

